/*******************************************************************************
 * Copyright (c) 2005 Koji Hisano <hisano@users.sourceforge.net>
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 *
 * Contributors:
 *     Koji Hisano - initial API and implementation
 *******************************************************************************/
package jp.sf.mapswidgets.sample;

import jp.sf.mapswidgets.GoogleMaps;
import jp.sf.mapswidgets.GoogleMapsAdapter;
import jp.sf.mapswidgets.Marker;
import jp.sf.mapswidgets.Overlay;
import jp.sf.mapswidgets.Point;

public final class Click extends GoogleDocumentSample {
	public static void main(String [] arguments) {
		new Click().run();
	}
	
	private Click() {
		super("Click Handling", "http://www.google.com/apis/maps/documentation/#Click_Handling");
	}

	void runScript(final GoogleMaps map) {
		map.setSmallMapControlVisible(true);
		map.setMapTypeControlVisible(true);
		map.setCenter(new Point(-122.1419, 37.4419));
		map.setZoomLevel(4);
		
		map.addGoogleMapsListener(new GoogleMapsAdapter() {
			public void clicked(Overlay clicked) {
				map.removeOverlay(clicked);
			}
			
			public void clicked(Point point) {
				map.addOverlay(new Marker(point));
			}
		});
	}
}
